CBASE
CHBASE

Syntax: CBASE [(#ch)]
   and: CHBASE [(#ch)]
    or: CHBASE (chidx%, chtag%)
Location: QBASE (DIY Toolkit Vol Q) (CHBASE) and BTool (CBASE)

CHBASE and CBASE are both functions which return the start address of a window definition block.

This block contains a wide range of information about a window, such as the size and colour settings.

The window is normally specified by its SuperBASIC channel number, eg: CBASE(#2), where the default is #1

However, CHBASE allows you to use the internal channel ID; which must be split into index (chidx%) and tag (chtag%).

The latter syntax allows you to access the windows of jobs other than the current job.

Inside knowledge about the operating system is necessary to access these tables. Please refer to QDOS system documentation. The structure of the window definition block is different under Thors, original QLs and the Pointer Environment.

CHBASE returns small negative integers if an error occurs, representing the QDOS error code:

-1  Window is currently in use, eg. awaiting input.
-6  No such channel exists.
-15  It's a channel but not a window.

Example:
The current INK colour is found at offset $46, so:

INK 7: PRINT PEEK( CHBASE+ HEX('46') )

will print 7, because of the INK 7 command.

CROSS-REFERENCE:
See also CHAN_B% and related functions.
